<template>
	<view class="mainpadding" v-if="pageShow" style="padding-bottom: 150rpx;">
		<view class="tupbox dingwei">
			<image :src="dataAll.bg_image_text" mode=""></image>
			<view class="nkbtn weizhi" v-if="type==2">{{dataAll.price}}元/{{dataAll.days}}天</view>
			<view class="nzti zitiwz">{{dataAll.name}}</view>
		</view>
		<!-- 会员信息 -->
		<view class="margin_top" v-if="type==1">
			<view class="ershiba xiaohui nofonweight margin_top1">你的权益卡将于{{dataAll.end_time_text}}过期</view>
			<view class="ershiba xiaohui nofonweight margin_top2">开始时间{{dataAll.start_time_text}}</view>
		</view>
		<!-- 会员须知 -->
		<view class="margin_top4">
			<view class="ershiba fonweight xiaohei">权益卡须知</view>
			<view class="margin_top">
				<image class="cgtpiam" :src="item" mode="widthFix"  v-for="(item,index) in dataAll.des_images_text" :key="item.id" @click="lbtpriview(index,dataAll.des_images_text)"></image>
			</view>
		</view>
		<!-- 固定底部 -->
		<view class="gudingdb mainpadding" v-if="type==2">
			<view class="huangbtnty" @click="tzhuiyff">购买权益卡</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				listid: "",
				pageShow:false,
				userInfo:{},
				dataAll:{},
				type:2,//1我的权益卡,2权益卡
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.type = options.type
			this.getDetail()
			// this.userinfomsg()
		},
		methods: {
			lbtpriview(index, arr) {
				var i = arr; //获取当前页面的轮播图数据
				//uniapp预览轮播图
				uni.previewImage({
					current: index, //预览图片的下标
					urls: i //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
				})
			},
			userinfomsg() {
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					this.userInfo = res.data
				})
			},
			getDetail() {
				let url = "/api/hyqycard/getHyqycardDetail"
				if(this.type==1){
					url = "/api/Hyqycard/userHyqycardCardDetail"
				}
				httpRequest.request(url, 'GET', {
					id: this.listid
				}).then(res => {
					this.dataAll = res.data
					this.pageShow = true
				})
			},
			tzhuiyff() {
				uni.navigateTo({
					url: '/pages_mypage/huiyuanfufei?type=2&id='+this.listid+"&price="+this.dataAll.price
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.cgtpiam {
		// height: 360rpx;
		width: 100%;
	}
	.line {
		width: 2rpx;
		height: 67rpx;
		background-color: #BAC3D5;
	}

	.touxiang {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;

		image {
			width: 100%;
			height: 100%;
			border-radius: 50%;
		}
	}

	.ckzi {
		font-size: 44rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #576E8B;
	}

	.ykzt {
		font-size: 44rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #DC9253;
	}

	.jkzt {
		font-size: 44rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #E8A10C;
	}

	.zitiwz {
		position: absolute;
		top: 90rpx;
		left: 190rpx;
	}

	.ckbtn {
		background-color: #A1BCDE;
		border-radius: 0 30rpx 30rpx 0;
		font-size: 26rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 140rpx;
		height: 50rpx;
	}

	.nzti {
		font-size: 44rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #F5E1B5;
	}

	.ykbtn {
		background-color: #F9C99E;
		border-radius: 0 30rpx 30rpx 0;
		font-size: 26rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #F2892E;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 140rpx;
		height: 50rpx;
	}

	.jkbtn {
		background-color: #FFE8C0;
		border-radius: 0 30rpx 30rpx 0;
		font-size: 26rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #F8890A;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 140rpx;
		height: 50rpx;
	}

	.nkbtn {
		background-color: #D3B47D;
		border-radius: 0 30rpx 30rpx 0;
		font-size: 26rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #2D2113;
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 0 15rpx;
		height: 50rpx;
	}

	.weizhi {
		position: absolute;
		top: 30rpx;
		left: 0;
	}

	.tupbox {
		width: 100%;
		height: 240rpx;

		image {
			width: 100%;
			height: 100%;
			border-radius: 10rpx;
		}
	}
</style>